package org.nepu.scr.indexrate.converter.drillingrate.jobarticulation;

import cn.hutool.json.JSONUtil;
import org.nepu.scr.indexrate.vo.drillingrate.jobarticulation.OtherJob;

import javax.persistence.AttributeConverter;
import javax.persistence.Convert;

@Convert
public class OtherJobConverter implements AttributeConverter<OtherJob, String> {
    @Override
    public String convertToDatabaseColumn(OtherJob otherJob) {
        return JSONUtil.toJsonStr(otherJob);
    }

    @Override
    public OtherJob convertToEntityAttribute(String s) {
        return JSONUtil.toBean(s, OtherJob.class);
    }
}
